package com.qinghuan.pojo;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;

/**
 * @Auther: qinghuan
 * @Date: 2022/3/5 13:55
 * @Description:
 */
@Entity
@Table(name = "category")
public class Category implements Serializable {

    private int id;
    private String name;
    private Set<Product> products;

    @OneToMany(fetch = FetchType.EAGER)
    @JoinColumn(name = "cid")
    public Set<Product> getProducts() {
        return products;
    }

    public void setProducts(Set<Product> products) {
        this.products = products;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
